package com.blog.service.impl;

import com.blog.bean.FriendChain;
import com.blog.mapper.FriendChainMapper;
import com.blog.service.FriendChainService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FriendChainServiceImpl implements FriendChainService {

    @Resource
    private FriendChainMapper friendChainMapper;

    @Override
    public int deleteByPrimaryKey(Long friendChainId) {
        return friendChainMapper.deleteByPrimaryKey(friendChainId);
    }

    @Override
    public int insert(FriendChain record) {
        return friendChainMapper.insert(record);
    }

    @Override
    public int insertSelective(FriendChain record) {
        return friendChainMapper.insertSelective(record);
    }

    @Override
    public FriendChain selectByPrimaryKey(Long friendChainId) {
        return friendChainMapper.selectByPrimaryKey(friendChainId);
    }

    @Override
    public int updateByPrimaryKeySelective(FriendChain record) {
        return friendChainMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(FriendChain record) {
        return friendChainMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<FriendChain> selectFriendChain(FriendChain record) {
        return friendChainMapper.selectFriendChain(record);
    }

    @Override
    public FriendChain getFriendChain(FriendChain record) {
        List<FriendChain> list = this.selectFriendChain(record);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }
}
